<template>
    <el-autocomplete
            :debounce = 0
            value-key="kouShiTiMu"
            class="inline-input"
            v-model="state2"
            :fetch-suggestions="querySearch"
            placeholder="请输入内容"
            :trigger-on-focus="true"
            @select="handleSelect"
            @focus="focusYanzheng"
            @blur="focusYanzheng"
    ></el-autocomplete>
</template>

<script>
    import {koushitiMohu} from '../http/api'
    import axios from '../http/http'
    export default {
        name: "Autocomplete",
        data(){
            return{
                blurSatte:true,
                state2:'',
                jianYiList:[]
            }
        },
        methods:{
            querySearch(queryString, cb) {
                axios({
                    url:koushitiMohu,
                    params:{kouShiTiMu:queryString},
                    method:'post'
                }).then(res=>{
                    this.jianYiList = res.data.list
                    cb(res.data.list);
                })
            },
            handleSelect(item) {
                console.log('select')
                // console.log(item)
            },
            blurAutoComplete(){
                console.log('blur')
                // console.log(this.state2)
                // console.log(this.jianYiList)
            },
            focusYanzheng(){
                this.$on('blur',this.blurAutoComplete)
            }
        }
    }
</script>

<style scoped>

</style>